﻿@using Abp.Json
@using MyCompanyName.AbpZeroTemplate.MultiTenancy
@using MyCompanyName.AbpZeroTemplate.Web.Models.TenantRegistration
@addTagHelper *, PaulMiami.AspNetCore.Mvc.Recaptcha
@{
    ViewBag.DisableTenantChange = true;
}
@model TenantRegisterViewModel
@section Scripts
    {
    <script>
        window.passwordComplexitySetting = @Html.Raw(Model.PasswordComplexitySetting.ToJsonString(indented: true));
    </script>
    <environment names="Development">
        <script src="~/view-resources/Views/TenantRegistration/Register.js" asp-append-version="true"></script>
    </environment>

    <environment names="Staging,Production">
        <script src="~/view-resources/Views/TenantRegistration/Register.min.js" asp-append-version="true"></script>
    </environment>

    <recaptcha-script />
}
<div class="m-login m-login__signin">
    <div class="m-login__head">
        <h3 class="m-login__title">
            @L("TenantSignUp")
        </h3>
        <small>
            @if (Model.EditionId.HasValue)
            {
                <div class="hint text-center">(@L("Edition"): @Model.Edition.DisplayName)</div>
            }
        </small>
    </div>
    <form class="m-login__form m-form register-form" asp-action="Register" method="post" id="formTenantRegister">
        <input type="hidden" Name="EditionId" value="@Model.EditionId" />
        @if (Model.EditionId.HasValue)
        {
            <input type="hidden" Name="SubscriptionStartType" value="@Model.SubscriptionStartType" />
                <input type="hidden" name="EditionPaymentType" value="@Model.EditionPaymentType" />
                <input type="hidden" name="Gateway" value="@Model.Gateway" />
                <input type="hidden" name="PaymentId" value="@Model.PaymentId" />
        }

        @if (@ViewBag.ErrorMessage != null)
        {
            <div class="alert alert-danger">
                <i class="fa fa-warning"></i> @ViewBag.ErrorMessage
            </div>
        }

        <h4 class="m-login__title">
            @L("TenantInformations")
        </h4>
        <div class="form-group m-form__group">
            <input class="form-control form-control m-input" type="text" placeholder="@L("TenancyName")" name="TenancyName" required maxlength="@Tenant.MaxTenancyNameLength" />
        </div>
        <div class="form-group m-form__group">
            <input class="form-control form-control m-input" type="text" placeholder="@L("Name")" name="Name" required maxlength="@MyCompanyName.AbpZeroTemplate.Authorization.Users.User.MaxNameLength" />
        </div>

        <h4 class="m-login__title m--margin-top-20">
            @L("AccountSettings")
        </h4>
        <div class="form-group m-form__group">
            <input class="form-control form-control m-input" type="email" placeholder="@L("AdminEmailAddress")" name="AdminEmailAddress" required maxlength="@MyCompanyName.AbpZeroTemplate.Authorization.Users.User.MaxEmailAddressLength" />
        </div>
        <div class="form-group m-form__group">
            <input class="form-control form-control m-input" type="password" autocomplete="off" id="AdminPassword" placeholder="@L("AdminPassword")" name="AdminPassword" required />
        </div>
        <div class="form-group m-form__group">
            <input class="form-control form-control m-input" type="password" autocomplete="off" placeholder="@L("AdminPasswordRepeat")" name="AdminPasswordRepeat" required />
        </div>
        @if (ViewBag.UseCaptcha)
        {

            <h4 class="m-login__title m--margin-top-20">
                @L("Captha_Hint")
            </h4>

            <div class="form-group margin-bottom-20">
                <recaptcha />
            </div>
        }
        <div class="m-portlet__body">
            <div class="m-login__form-action">
                <a asp-action="SelectEdition" asp-controller="TenantRegistration">
                    <button type="button" id="register-back-btn" class="btn btn-outline-primary  m-btn m-btn--pill m-btn--custom">@L("Back")</button>
                </a>
                <button type="submit" id="register-submit-btn" class="btn btn-primary m-btn m-btn--pill m-btn--custom m-btn--air">@L("Submit")</button>
            </div>
        </div>
    </form>
</div>    